package com.situ.spring.proxy;

import com.situ.spring.service.IBanjiService;
import com.situ.spring.service.impl.BanjiServiceImpl;
import org.junit.Test;

public class Client {

    public static void main(String[] args) {
        DongShiZhang dongShiZhang = new DongShiZhang();
        IQianzi mishu = new MiShu(dongShiZhang);

        mishu.qianzi();
    }

    @Test
    public void test1() {
        DongShiZhang dongShiZhang = new DongShiZhang();
        IQianzi qianzi = (IQianzi) ProxyFactory.getProxyInstance(dongShiZhang);
        qianzi.qianzi();
    }

    @Test
    public void test2() {
        DongShiZhang dongShiZhang = new DongShiZhang();
        IQianzi qianzi = (IQianzi) ProxyFactory.getProxyInstance(dongShiZhang);
        qianzi.qianzi();
    }

    @Test
    public void test3() {
        IBanjiService banjiService = new BanjiServiceImpl();
        IBanjiService proxy = (IBanjiService) ProxyFactory.getProxyInstance(banjiService);
        proxy.selectAll();
        proxy.deleteById(1);
    }
}
